home *** CD-ROM | disk | FTP | other *** search
- WGT Sprite Editor Conversion Utilities
- Copyright 1996 Chris Egerter
-
- Introduction:
- -------------
- While the WGT Sprite Editor was designed for use with the
- WordUp Graphics Toolkit, there is no reason why you cannot load the
- files into other graphics modes and use them with other graphics
- libraries. This set of utility programs provide an easy solution
- to converting WGT Sprite Files.
-
- With this set of conversion programs, the WGT Sprite Files act as a
- standard format. Other graphics libraries may convert a WGT Sprite
- File into their own format, but not vice-versa. For this reason,
- a library of sprite images should be kept in the WGT format, and
- users will be able to convert them into any other library as they wish.
-
- The following is a list of libraries supported, along with their
- authors in brackets.
-
- * BGI C version (Borland Graphics Interface)
- * BGI Pascal version (Borland Graphics Interface)
- * Xlib C version (by Themie Gouthas)
- * FastGraph 256 color C version (by Ted Gruber)
- * FastGraph 16 color C version (by Ted Gruber)
- * GameTP (by Scott Ramsay)
- * AniVGA (by Kai Korbacher)
- * The Graphics Engine (by Matthew Hildebrand)
-
-
- The Sprite File Format:
- -----------------------
- The WGT Sprite File contains one palette, and a number of bitmapped
- images. Here is the format of the sprite files:
-
- 1 integer : Version number (Latest is 4)
- 13 bytes : contains " Sprite File " (with spaces at ends)
- 768 unsigned char : palette info
- 1 integer : max number of sprites in file
- Version 4.0 is 2000
- Version 3.5 is 1000
- <3.5 is 200
-
- if VERSION = 4, startspr = 0
- else startspr = 1
- sprite structures { (startspr to max sprite)
- 1 integer: sprite made (0 or 1)
- if sprite is made (==1), then read in (block format)
- {
- 2 integers : width and height
- width*height bytes : image data
- }
- end
-
-
- Since the image data is one byte per pixel, each pixel can have a
- value of 0-255, which is its color. The best way to convert a
- file to any mode is to let the graphics library initialize the
- mode, and plot individual pixels in each sprite. This relies on the
- library functions only, so it may be ported to any library ever written!
- The only requirements are the library has the following commands:
-
- putpixel
- getimage (grabs a portion of the screen into system ram)
- putimage (puts an image from system ram to video ram)
- setpalette (if you have modified the colors)
-
- These are extremely basic functions, and all libraries should have them.
- The utility programs are meant to be used in the middle of the
- development stage, and not during the actual program execution.
- Since the conversion programs draw each image pixel by pixel, running
- them within your main program would be slow and unpractical.
- If you wish to make your program run in various graphics modes, you
- should keep different sprite files, one for each mode. These should
- be converted ahead of time, and can simply be loaded in depending on
- which mode you choose.
-
-
- With this idea in mind, I have created a generic conversion program which
- uses the BGI libraries which are included with all Borland programming
- languages. If you are using a library which does not have a conversion
- program in this set, use the spr2bgi program as a template and modify
- the graphics commands as needed. If you are writing a new graphics
- library yourself, please send your modified conversion program to me,
- so I may include it in the next release of the WGT Sprite Editor.
-
-
- Dealing with Palettes:
- ----------------------
- Palettes become a little tricky when converting a 256 colour image
- to an image with lesser colours, for example VGA 640x350 16 colour mode.
- Some modes do not allow you to change the palette at all. If you know
- ahead of time which mode you will be using, set the first colours
- of the palette to match the ones available in your graphics mode.
- You can then draw your images using only the available colours.
- In this situation, your graphics will appear exactly as drawn. In the
- VGA 16 colour modes, you may modify the palette. In EGA modes, you
- cannot change the red,green, and blue values of the palette. For this
- reason, you should use the 'standard.pal' file as the palette. This
- contains the default colours for EGA and VGA modes.
-
- If you have drawn your images with 256 colours, and wish you use them
- in a mode with less colours, you must first remap the sprites with the
- palette with fewer colours. To do this, see the remap sprites tool
- in the Sprite Editor documentation. To remap your sprites to a 16 color
- palette, set the first 16 colors to the normal palette for that mode, and
- set the rest to black. This will ensure that any colors >15 will not be
- used. You should also set colors 252-255 which are normally reserved by
- the Sprite Editor as shades of grey. To set them, hold down the ALT key
- while on the 4 colors in color selector.
-
-
-